window.onload = function(){
    var oTab = document.getElementById("tabs");
    var oUl = oTab.getElementsByTagName("ul")[0];
    var oLis = oUl.getElementsByTagName("li");
    var oDivs= oTab.getElementsByTagName("div");

    for(var i= 0,len = oLis.length;i<len;i++){
        oLis[i].index = i;
        oLis[i].onclick = function() {
            for(var n= 0;n<len;n++){
                oLis[n].className = "";
                oDivs[n].className = "hide";
            }
            this.className = "on";
            oDivs[this.index].className = "";
        };
    }
}

function changeSide(){
    var oTab = document.getElementById("sideTabs");
    var oUl = oTab.getElementsByTagName("ul")[0];
    var oLis = oUl.getElementsByTagName("li");
    var oDivs= oTab.getElementsByTagName("div");

    for(var i= 0,len = oLis.length;i<len;i++){
        oLis[i].index = i;
        oLis[i].onclick = function() {
            for(var n= 0;n<len;n++){
                oLis[n].className = "";
                oDivs[n].className = "hide";
            }
            this.className = "on";
            oDivs[this.index].className = "";
        }
    };
}

function changeBottom(){
    var oTab = document.getElementById("bottomTabs");
    var oUl = oTab.getElementsByTagName("ul")[0];
    var oLis = oUl.getElementsByTagName("li");
    var oDivs= oTab.getElementsByTagName("div");

    for(var i= 0,len = oLis.length;i<len;i++){
        oLis[i].index = i;
        oLis[i].onclick = function() {
            for(var n= 0;n<len;n++){
                oLis[n].className = "";
                oDivs[n].className = "hide";
            }
            this.className = "on";
            oDivs[this.index].className = "";
        }
    };
}

function search(){
    urlstr="http://find.nlc.gov.cn/search/doSearch?query="+ encodeURIComponent(document.getElementById("Wenjinsearch").value) +"&secQuery=&actualQuery="+ encodeURIComponent(document.getElementById("Wenjinsearch").value) +"&searchType=2&docType=%E5%85%A8%E9%83%A8&isGroup=isGroup&targetFieldLog=%E5%85%A8%E9%83%A8%E5%AD%97%E6%AE%B5&fromHome=true";
    window.open(urlstr);
}

function keyact(){
    if(window.event.keyCode==13){
        search();
    }
}


